Notice: While JavaScript is not essential for this website, your interaction with the content will be limited. Please turn JavaScript on for the full experience.
...change the name of the project. In particular, supporting version epochs allows a project that was previously using date based versioning to switch to semantic versioning by specifying a new version epoch. The ! character was chosen to delimit an epoch version rather than the : character, which is commonly used in other systems, due to the fact that : is not a valid character in a Windows directory name. Adding direct references Direct references are added as an "escape clause" to handle messy...
...core, and characters carrying the Other_ID_Start property. XID_Start then closes this set under normalization, by removing all characters whose NFKC normalization is not of the form ID_Start ID_Continue* anymore. ID_Continue is defined as all characters in ID_Start, plus nonspacing marks (Mn), spacing combining marks (Mc), decimal number (Nd), connector punctuations (Pc), and characters carrying the Other_ID_Continue property. Again, XID_Continue closes this set under NFKC-normalization; it also...
...ce where this slot is referenced should be PyObject_GetIter(), and this can check for the Py_TPFLAGS_HAVE_ITER flag directly). (Note: the tp_iter slot can be present on any object; the tp_iternext slot should only be present on objects that act as iterators.) For backwards compatibility, the PyObject_GetIter() function implements fallback semantics when its argument is a sequence that does not implement a tp_iter function: a lightweight sequence iterator object is constructed in that case which ...
...ckagers' work easier when repackaging standards compliant distributions, because as of now it can be difficult to decide how two distribution versions compare. Requisites and current status It is not in the scope of this PEP to provide a universal versioning schema intended to support all or even most of existing versioning schemas. There will always be competing grammars, either mandated by distro or project policies or by historical reasons that we cannot expect to change. The proposed schem...
...cit markup construct. Comments are not visible in the processed document. For example: .. This section should be updated in the final PEP. Ensure the date is accurate. Escaping Mechanism reStructuredText uses backslashes ("\") to override the special meaning given to markup characters and get the literal characters themselves. To get a literal backslash, use an escaped backslash ("\\"). There are two contexts in which backslashes have no special meaning: literal blocks and inline l...
...components. On Windows, this method will also take care to return the canonical path (with the right casing). Directory walking Simple (non-recursive) directory access is done by calling the iterdir() method, which returns an iterator over the child paths: >>> p = Path('docs') >>> for child in p.iterdir(): child ... PosixPath('docs/conf.py') PosixPath('docs/_templates') PosixPath('docs/make.bat') PosixPath('docs/index.rst') PosixPath('docs/_build') PosixPath('docs/_static')...
...c method, the dict type could just grow a classmethod something like dict.fromblock that could be used like: make dict.fromblock params: x = 1 y = 2 So the question is, will many types want to use the make-statement as an alternate constructor? And if so, does that alternate constructor need to have the same name as the original constructor? Customizing the dict in which the block is executed Should users of the make-statement be able to determine in which dict object the code is ex...
...ce to a protocol is checked, nor what the consequences may be of claiming compliance but not actually delivering it (lack of "syntactic" compliance -- names and signatures of methods -- will often lead to exceptions being raised; lack of "semantic" compliance may lead to subtle and perhaps occasional errors [imagine a method claiming to be threadsafe but being in fact subject to some subtle race condition, for example]; lack of "pragmatic" compliance will generally lead to code that runs correct...
...cutils.io.NullOutput). A single tree-shaped data structure in memory. Some other set of data structures in memory. Docutils Package Structure Package "docutils". Module "__init__.py" contains: class "Component", a base class for Docutils components; class "SettingsSpec", a base class for specifying runtime settings (used by docutils.frontend); and class "TransformSpec", a base class for specifying transforms. Module "docutils.core" contains facade class "Publisher" and convenience functio...
...ce dict, to distinguish it from the type dict. In the more complicated case, there's a conflict between names stored in the instance dict and names stored in the type dict. If both dicts have an entry with the same key, which one should we return? Looking at classic Python for guidance, I find conflicting rules: for class instances, the instance dict overrides the class dict, except for the special attributes (like __dict__ and __class__), which have priority over the instance dict. I resolve...
...creation of basic blocks must be done. Below are the macros and functions used for managing basic blocks: NEW_BLOCK() create block and set it as current NEXT_BLOCK() basically NEW_BLOCK() plus jump from current block compiler_new_block() create a block but don't use it (used for generating jumps) Once the CFG is created, it must be flattened and then final emission of bytecode occurs. Flattening is handled using a post-order depth-first search. Once flattened, jump offsets are back...
...cost developer-focused Python conference called PyCon. This conference format proved to be quite successful and the conference has experienced substantial growth in size and offerings each year. The original PyCon conference is held in North America. In 2007, PyCon-style conferences were added in Italy, the UK and Brasil. The PSF has been closely involved with the North American PyCon since its creation. It provides the financial backing that is necessary to plan and run the conference, and has ...
...col Mirrors must reduce the amount of data transferred between the central server and the mirror. To achieve that, they MUST use the changelog() PyPI XML-RPC call, and only refetch the packages that have been changed since the last time. For each package P, they MUST copy documents /simple/P/ and /serversig/P. If a package is deleted on the central server, they MUST delete the package and all associated files. To detect modification of package files, they MAY cache the file's ETag, and MAY reque...
...ception in the new exception message). When catching exceptions, mention specific exceptions whenever possible instead of using a bare except: clause: try: import platform_specific_module except ImportError: platform_specific_module = None A bare except: clause will catch SystemExit and KeyboardInterrupt exceptions, making it harder to interrupt a program with Control-C, and can disguise other problems. If you want to catch all exceptions that signal program errors, use except Except...
...C hooks alone: The GC hook semantics aren't part of the abstract async iterator protocol, but are instead restricted specifically to the async generator concrete type. If you have an async iterator implemented using a class, like: class MyAsyncIterator: async def __anext__(): ... then you can't refactor this into an async generator without changing its semantics, and vice-versa. This seems very unpythonic. (It also leaves open the question of what exactly class-based async iterato...
...ccurs twice in the list. The second occurrence is redundant, since anything that could be found there would already have been found when searching the first occurrence. We use this observation to explain our new lookup rule. Using the classic lookup rule, construct the list of classes that would be searched, including duplicates. Now for each class that occurs in the list multiple times, remove all occurrences except for the last. The resulting list contains each ancestor class exactly once ...
...cannot reveal bits of the SipHash24 seed. memory layout on 64 bit systems: cccccccc cccccccc cccccccc uc -- unsigned char[24] pppppppp ssssssss ........ fnv -- two Py_hash_t k0k0k0k0 k1k1k1k1 ........ siphash -- two PY_UINT64_T ........ ........ ssssssss djbx33a -- 16 bytes padding + one Py_hash_t ........ ........ eeeeeeee pyexpat XML hash salt memory layout on 32 bit systems: cccccccc cccccccc cccccccc uc -- unsigned char[24] ppppssss ........ ........ fnv -- two Py_hash_t k0k0k0k0 k...
...Callback function arguments When an active event occurs, the registered callback function is called. Different events will provide the callback function with different arguments, as follows: All events starting with PY_: func(code: CodeType, instruction_offset: int) C_CALL and C_RETURN: func(code: CodeType, instruction_offset: int, callable: object) RAISE and EXCEPTION_HANDLED: func(code: CodeType, instruction_offset: int, exception: BaseException) LINE: func(code: CodeType, line_numb...
...contains coefficients for element 1, row 5:8 coefficients for element 2) and each column is associated to a given degree of accuracy ("accuracy" or "Z" axis) so that first column is low accuracy, second column is medium accuracy and so on. With that indexing, the user would obtain another object representing the contents of the column of the internal table for accuracy level 3. Additionally, the keyword specification can be used as an option contextual to the indexing. Specifically: A "defaul...